#!/bin/bash
# $Id: aasp_mon.sh 717 2010-08-20 14:24:59Z ant_code $

# bashrc should be sourced
if [[ "$running_mode" =~ installer|autoinstall ]]; then
	. $scripts_dir/env
else
	. /lib/dsktool/conf/env
fi
. $scripts_dir/common.fn
. $scripts_dir/vault.fn

date "+%s" > /var/tmp/aasp_timer
while true; do
	if [ /var/tmp/aasp_timer ]; then
		t1="$(</var/tmp/aasp_timer)"
		t2="$(date "+%s")"
		if [ "$(($t1 + 235))" -lt "$t2" -a "$(<$disk_commit_switch_running)" = "0" ]; then
			_warn_msg "Deleting vault password... timer expired after 240 seconds."
			rm -f $vp_pass
			__sane_kdir	
			exit 0
		fi
	else
		rm -f $vp_pass
		__sane_kdir	
		exit 0
	fi
	sleep 5
done

# vim: ts=2 syn=sh
# aasp_mon.sh: end
